export function extractImageUrls(content?: string): string[] {
  if (!content) return []
  const urls = new Set<string>()
  // Markdown ![alt](url "title")
  const md = /!\[[^\]]*\]\(([^)\s]+)(?:\s+\".*?\")?\)/g
  let m: RegExpExecArray | null
  while ((m = md.exec(content)) !== null) {
    if (m[1]) urls.add(m[1].trim())
  }
  // HTML <img src="...">
  const html = /<img\s+[^>]*src=\"([^\"]+)\"[^>]*>/gi
  let h: RegExpExecArray | null
  while ((h = html.exec(content)) !== null) {
    if (h[1]) urls.add(h[1].trim())
  }
  return Array.from(urls)
}
